BuffEffect2 = BaseBuffEffect:new();
BuffEffect2.__index = BuffEffect2;

function BuffEffect2:new()
    local object = {};
    setmetatable(object, BuffEffect2);
    return object;
end

function BuffEffect2:add(fight,buff)
    fightLog("[EFFECT]Fighter "..buff.target.fighterId.." Buff"..buff.modelId.." 增加击退BUFF效果");
    return BaseBuffEffect:add(fight, buff);
end

function BuffEffect2:action(fight,buff,...)
    if FighterManager.isDie(buff.target) then
        return EnumConst.IBuffEffect.SUCCESS;
    end
    local back = 0;
    local buffEffectValue = decodeJsonStrToTabel(buff.buffBean.f_BuffEffectValue);
    if buffEffectValue[1] > 0 then
            back = buffEffectValue[1] / EnumConst.FIGHT_FRAME;
    elseif buffEffectValue[2] > 0 then
        if buff.buffBean.f_BuffRound > 0 and buff.buffBean.f_BuffTime > 0 then
            back = buffEffectValue[2] / (buff.buffBean.f_BuffRound / buff.buffBean.f_BuffTime);
        else
            back = buffEffectValue[2];
        end
    end

    -- 被击者后退
    buff.target.position.x = buff.target.position.x + buff.addParameter[1].targetDirection * back / EnumConst.TEN_THOUSANDTH;
    local out = false;
    if buffEffectValue[3] == 0 then
        checkOut(buff.target, EnumConst.FIGHT_INNER_ROUND);
    else
        checkOut(buff.target, EnumConst.FIGHT_OUTER_ROUND);
    end

    local time = 0;
    if buff.buffBean.f_BuffTime > 0 then
        time = buff.buffBean.f_BuffRound;
    else
        time = EnumConst.FIGHT_FRAME;
    end
    
    buff.target:showRepulse(time,buffEffectValue[2]/time*1000,Vector2(buff.target.position.x,buff.target.position.y));
    fightLog("[EFFECT]Fighter "..buff.target.fighterId.." Buff"..buff.modelId.." 击退到"..printVector2(buff.target.position.x,buff.target.position.y));
    if out then
        return EnumConst.IBuffEffect.REMOVE;
    end

    return BaseBuffEffect:action(fight, buff, ...);
end